package string;

/**
 * char CharAt(int index):
 * 返回当前字符串指定位置上的字符（index）----根据位置找字符
 */
public class CharAtDemo {
    public static void main(String[] args) {
        String str = "thinking in java";
        char c = str.charAt(9);
        System.out.println(c);//i
        String line = "0987654321zxcvbnmasdfghjklqwertyuiopZXCVBNMASDFGHJKLQWERTYUIOP";
        char[]chs = new char[4];
        for(int i =0;i<4;i++){
            int index = (int)(Math.random()*62);
            chs[i]= line.charAt(index);
        }
        String code = chs[0]+""+chs[1]+""+chs[2]+""+chs[3]+"";
        System.out.println(code);
    }
}
